package com.cenxi.common.util.req;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author cenxi
 * @Date 2023/8/16 14:39
 * @Version 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class PageReq<T> {
    public static final int DEFAULT_PAGE_INDEX = 1;
    public static final int DEFAULT_PAGE_SIZE = 10;
    private static final long serialVersionUID = 1L;

    private T data;

    @Builder.Default
    @ApiModelProperty(value = "当前页 默认第1页", required = true, example = "1")
    private int pageIndex = DEFAULT_PAGE_INDEX;

    @Builder.Default
    @ApiModelProperty(value = "当前页大小 默认10条", required = true, example = "10")
    private int pageSize = DEFAULT_PAGE_SIZE;

    public static <T> PageReq<T> create() {
        return PageReq.<T>builder()
                .build();
    }
}
